package com.mhc.suzuki.constant;

/**
 * Created by HMJ on 2017/9/5.
 */
public enum BeMarriedEnum {

    //已婚有子女
    MARRIED_WITH_CHILDREN(0, "已婚有子女"),
    MARRIED_WITHOUT_CHILDREN(1, "已婚无子女"),
    UNMARRIED_SINGLE(2, "未婚单身"),
    DIVORCED_SINGLE(3, "离异单身"),
    SPOUSE_SINGLE(4, "丧偶单身");


    private Integer code;
    private String name;

    BeMarriedEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getName() {
        return this.name;
    }

    public static BeMarriedEnum getBeMarriedEnum(Integer code) {
        for (BeMarriedEnum beMarriedEnum : BeMarriedEnum.values()) {
            if (beMarriedEnum.code.equals(code)) {
                return beMarriedEnum;
            }
        }
        //没有对应的类型，默认用其他类型
        return BeMarriedEnum.UNMARRIED_SINGLE;
    }


    public static Boolean isBeMarriedEnum(Integer code) {
        /**判断是否已婚，已婚返回true，未婚返回fasle**/
        return BeMarriedEnum.MARRIED_WITH_CHILDREN.getCode().equals(code) || BeMarriedEnum.MARRIED_WITHOUT_CHILDREN.getCode().equals(code);
    }


}
